package ynu.sxp.demoapp.entity;

import jakarta.persistence.*;
import lombok.Data;
import ynu.sxp.demoapp.common.BaseEntity;

import java.math.BigDecimal;
import java.util.List;

@Data
@Entity
@Table(name = "orders")
public class Orders extends BaseEntity {
    @Column(length = 20, nullable = false)
    private String userId;

    @Column(nullable = false)
    private Integer businessId;

    @Column(length = 20, nullable = false)
    private String orderDate;

    @Column(precision = 7, scale = 2, nullable = false)
    private BigDecimal orderTotal;

    @Column(nullable = false)
    private Integer daId;

    @Column(nullable = false)
    private Integer orderState;

    @OneToMany(mappedBy = "order", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
    private List<OrderDetailet> orderDetails;
}